/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.coupon.core.domain;

import info.peigen.hotpot.business.coupon.facade.enums.CouponCalculateType;
import info.peigen.hotpot.business.coupon.facade.enums.CouponType;
import info.peigen.hotpot.common.core.domain.DomainObject;
import info.peigen.hotpot.common.core.util.IdUtil;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * <b>(Coupon)</b>
 * 优惠券
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/6/27
 */
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class Coupon extends DomainObject {
    @NotEmpty
    @Builder.Default
    String couponId = IdUtil.id();
    /** 命名，便于记忆 */
    @NotEmpty
    String couponName;
    /** 标识在哪个活动中使用 */
    List<Promotion> promotions;
    /** 类型：直减券、折扣券、兑换券 */
    @NotNull
    CouponType            type;
    /** 计算类型：直减、阶梯、满减 */
    @NotNull
    CouponCalculateType   calculateType;
    /** 数量，发放数量上限 */
    @NotNull
    Long                  count;
    /** 是否达到上限标识 */
    @Builder.Default
    Boolean               limitReached = Boolean.FALSE;
    /** 领取策略 */
    @NotNull
    CouponReceiveStrategy receiveStrategy;
    /** 使用策略 */
    @NotNull
    CouponUseStrategy     useStrategy;
}